const mysql = require('mysql2');

const MYSQL_HOST="localhost";
const MYSQL_PORT="3306";
const MYSQL_DATABASE="word_production";
const MYSQL_USER="root";
const MYSQL_PASSWORD="123456";

const connection = mysql.createPool({
  host: MYSQL_HOST,
  port: MYSQL_PORT,
  database: MYSQL_DATABASE,
  user: MYSQL_USER,
  password: MYSQL_PASSWORD
});
connection.getConnection((err, conn) => {
  conn.connect((err) => {
    if(err) {
      console.log("连接失败", err);
    } else {
      console.log("数据库连接成功~");
    }
  })
});
module.exports = connection.promise();
